package com.irs.controller;

import com.irs.pojo.BuildingHouse;
import com.irs.service.BuildingHouseService;
import com.irs.util.ResultUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.List;

@Controller
public class BuildHouseController {
    @Autowired
    BuildingHouseService buildingHouseService;
    @GetMapping("/build/house")
    public String tobuildHouse(){
        //跳转到buildHouse.jsp
        return "page/build/buildHouse";
    }

    //查
    @GetMapping("/build/hoouse/list")
    @ResponseBody
    public Object buildHouseList(){
        List<BuildingHouse> buildingHouseList = buildingHouseService.select(new BuildingHouse());
        //返回JSON
        return  ResultUtil.ok(buildingHouseList, buildingHouseList.size());
    }
}
